package com.blog.mapper;

import com.blog.pojo.AdminInfoVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AdminMapper {
    @Select("SELECT id, username, email, created, image, identity FROM user NATURAL JOIN admin")
    List<AdminInfoVO> listAdmins();

    @Delete("DELETE FROM admin WHERE id = #{id}")
    void deleteAdmin(int id);

    @Insert("INSERT INTO admin VALUES (#{id},#{identity})")
    void insertAdmin(int id, String identity);
}
